package mytest.list;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Test3 {
    public static void main(String[] args) {
        String dateStr = "2024-09-26";

        DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE;
        DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyyMM");

        // 解析日期字符串
        LocalDate date = LocalDate.parse(dateStr, formatter);
        System.out.println(date.format(formatter2));
        System.out.println(date.minusMonths(1).format(formatter2));
        System.out.println(date.minusMonths(2).format(formatter2));
        System.out.println(date.minusMonths(3).format(formatter2));
        System.out.println(date.minusMonths(4).format(formatter2));
        System.out.println(date.minusMonths(5).format(formatter2));
        int year = date.getYear();
        int month = date.getMonthValue();
        String tableNameSuffix = String.format("%d%02d", year, month);

    }
}
